﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HR.Appointments.Service.DataAccessLayer
{
    /// <summary>
    /// Gets the orders from the database
    /// </summary>
    public interface IOrderDAO
    {
        /// <summary>
        /// Deletes an order from the database
        /// </summary>
        /// <param name="companyId">Company identifier</param>
        /// <param name="orderId">Order identifier</param>
        void Delete(int companyId, int orderId);

        /// <summary>
        /// Inserts a order into the database
        /// </summary>
        /// <param name="order">A valid entity</param>
        void Insert(OrderEntity order);

        /// <summary>
        /// Updates the order
        /// </summary>
        /// <param name="order">/// <returns>List of orders</returns></param>
        void Update(OrderEntity order);
        
        /// <summary>
        /// Get a single instance Order
        /// </summary>
        /// <param name="companyId">Company identifier</param>
        /// <param name="orderId">Order identifier</param>
        /// <returns></returns>
        OrderEntity GetInstance(int companyId, int orderId);
        
        /// <summary>
        /// Get all orders that is not older then today for a given company
        /// </summary>
        /// <param name="companyId">Company identifier</param>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetAllValidOrders(int companyId);
        
        /// <summary>
        /// Get orders by a specific date.
        /// </summary>
        /// <param name="companyId">Id of the company</param>
        /// <param name="date">Which date we want the orders</param>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetByDate(int companyId, DateTime date);
        
        /// <summary>
        /// Get order by phone number
        /// </summary>
        /// <param name="phone">Customers phone number</param>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetByPhone(string phone);

        /// <summary>
        /// Get all orders that are booked for tomorrow or one week after tomorrow.
        /// </summary>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetNotifiableBooked();

        /// <summary>
        /// Get all orders for a company that are not booked and have not been confirmed within the given 
        /// delaytime value or the unbooked time is tomorrow.
        /// </summary>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetNotifiableOrdered(int companyId, int delayTime);

        /// <summary>
        /// Get list of orders that has not been sent and are confirmed
        /// </summary>
        /// <returns>List of orders</returns>
        List<OrderEntity> GetUnSentByStatus(int companyId, OrderStatus status);
    }
}
